package com.example.hzq.zqb.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

import com.example.hzq.zqb.R;

/**
 * Created by hzq on 2017/7/12.
 */

public class MychoiceAcitivity extends AppCompatActivity implements View.OnClickListener{
    private int number;
    private ImageButton back;
    private ImageView image;
    private Spinner spinner;
    private Button enter;
    private TextView top;
    private String time[]={"0:00-2:00","2:00-4:00","4:00-6:00","6:00-8:00","8:00-10:00","10:00-12:00","12:00-14:00","14:00-16:00","16:00-18:00","18:00-20:00","20:00-22:00","22:00-24:00"};
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mychoice);
        spinner=(Spinner)findViewById(R.id.mc_choicetime);
        back=(ImageButton)findViewById(R.id.back1);
        enter=(Button)findViewById(R.id.mc_enter);
        top=(TextView)findViewById(R.id.toptext);
        image=(ImageView)findViewById(R.id.mc_image);
        number=getIntent().getIntExtra("num",0);
        back.setOnClickListener(this);
        enter.setOnClickListener(this);
        ArrayAdapter<String> adapter=new ArrayAdapter<String>(MychoiceAcitivity.this,android.R.layout.simple_spinner_item,time);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);
        switch (number){
            case 0:
                image.setImageResource(R.mipmap.aim1);
                top.setText("购物");
                break;
            case 1:
                image.setImageResource(R.mipmap.aim2);
                top.setText("旅游");
                break;
            case 2:
                image.setImageResource(R.mipmap.aim3);
                top.setText("攒第一桶金");
                break;
            case 3:
                image.setImageResource(R.mipmap.aim4);
                top.setText("我有我自己的规划目标");
                break;
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.back1:
                finish();
                break;
            case R.id.mc_enter:
                Toast.makeText(MychoiceAcitivity.this,"未完成",Toast.LENGTH_SHORT).show();
                break;
            default:break;
        }
    }
}
